IF exists(SELECT * FROM dbo.sysobjects WHERE name='studieExamensOLC' AND xtype='V') 
BEGIN
	DROP VIEW studieExamensOLC
END
GO

CREATE view studieExamensOLC
as

select l.voornaam+' '+l.achternaam as volleNaam,l.klas,l.klasNr,
        w1Ma=case when r.w1Ma like '1' then 'X' else '' end,
	w1Di=case when r.w1Di like '1' then 'X' else '' end,
	w1Wo=case when r.w1Wo like '1' then 'X' else '' end,
	w1Do=case when r.w1Do like '1' then 'X' else '' end,
	w1Vr=case when r.w1Vr like '1' then 'X' else '' end,
	w2Ma=case when r.w2Ma like '1' then 'X' else '' end,
	w2Di=case when r.w2Di like '1' then 'X' else '' end,
	w2Wo=case when r.w2Wo like '1' then 'X' else '' end,
	w2Do=case when r.w2Do like '1' then 'X' else '' end,
	w2Vr=case when r.w2Vr like '1' then 'X' else '' end,
	w3Ma=case when r.w3Ma like '1' then 'X' else '' end,
	w3Di=case when r.w3Di like '1' then 'X' else '' end,
	w3Wo=case when r.w3Wo like '1' then 'X' else '' end,
	w3Do=case when r.w3Do like '1' then 'X' else '' end,
	w3Vr=case when r.w3Vr like '1' then 'X' else '' end,
        r.olcPlaats




from refterStudieOLC as r
left join leerlingen as l
on l.inschrijvingsNr=r.inschrijvingsNr